<?php

namespace slinks\extensions\onecms\core\model;

class MenuItem implements IMenuNode {

    private $children = array();
    private $url;
    private $name;
    private $active;

    function __construct($name, $url, $children=array(),$active=false) {
        $this->name = $name;
        $this->url = $url;
        $this->children = $children;
        $this->active = $active;
    }

    /**
     * Adds a child to this node.
     *
     * @param IMenuNode $child
     */
    public function addChild(IMenuNode $child) {
        $this->children[] = $child;
    }

    /**
     * @return Boolean true if the node has children.
     */
    public function hasChildren() {
        return count($this->children) > 0;
    }

    /**
     * @return array the children of this node.
     */
    public function getChildren() {
        return $this->children;
    }

    public function setChildren($children) {
        $this->children = $children;
    }

    public function getUrl() {
        return $this->url;
    }

    public function setUrl($url) {
        $this->url = $url;
    }

    public function getName() {
        return $this->name;
    }

    public function setName($name) {
        $this->name = $name;
    }
    
    public function isActive() {
        return $this->active;
    }

    public function setActive($active) {
        $this->active = $active;
    }



}
